From 98b9ffc81ed3368706c3378e298600bec15ab631 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 6 Jul 2007 02:03:51 +0000 Subject: [PATCH] Gerhard Olsson and Robert Lipe add realtime tracking for XCSV and repair KML tracking. --- kml.c | 4 ++-- xcsv.c | 43 ++++++++++++++++++++++++++++++++++++++--- xmldoc/chapters/use.xml | 5 +++-- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/kml.c b/kml.c index b4f5ba951..90cc9b671 100644 --- a/kml.c +++ b/kml.c @@ -302,7 +302,7 @@ kml_wr_deinit(void) static void kml_wr_position_deinit(void) { - kml_wr_deinit(); +// kml_wr_deinit(); if (posnfilenametmp) { xfree(posnfilenametmp); posnfilenametmp = NULL; @@ -971,7 +971,7 @@ kml_wr_position(waypoint *wpt) track_del_wpt(posn_trk_head, tonuke); } -// kml_wr_deinit(); + kml_wr_deinit(); } ff_vecs_t kml_vecs = { diff --git a/xcsv.c b/xcsv.c index b6ff3163a..a9bfd3d10 100644 --- a/xcsv.c +++ b/xcsv.c @@ -600,12 +600,47 @@ xcsv_wr_init(const char *fname) is_fatal(xcsv_file.gps_datum < 0, MYNAME ": datum \"%s\" is not supported.", opt_datum); } +static void +xcsv_wr_position_init(const char *fname) +{ + xcsv_wr_init(fname); +} + static void xcsv_wr_deinit(void) { - gbfclose(xcsv_file.xcsvfp); + gbfclose(xcsv_file.xcsvfp); - xcsv_destroy_style(); + xcsv_destroy_style(); +} + +static void +xcsv_wr_position_deinit(void) +{ + xcsv_wr_deinit(); +} + + +static void +xcsv_wr_position(waypoint *wpt) +{ + /* Tweak incoming name if we don't have a fix */ + switch(wpt->fix) { + case fix_none: + if (wpt->shortname) { + xfree(wpt->shortname); + } + wpt->shortname = xstrdup("ESTIMATED Position"); + break; + default: + break; + } + + waypt_add(wpt); + xcsv_data_write(); + waypt_del(wpt); + + gbfflush(xcsv_file.xcsvfp); } ff_vecs_t xcsv_vecs = { @@ -619,7 +654,9 @@ ff_vecs_t xcsv_vecs = { xcsv_data_write, NULL, xcsv_args, - CET_CHARSET_ASCII, 0 /* CET-REVIEW */ + CET_CHARSET_ASCII, 0, /* CET-REVIEW */ + { NULL, NULL, NULL, xcsv_wr_position_init, xcsv_wr_position, xcsv_wr_position_deinit } + }; #else void xcsv_read_internal_style(const char *style_buf) {} diff --git a/xmldoc/chapters/use.xml b/xmldoc/chapters/use.xml index 167f475b3..1a93a0287 100644 --- a/xmldoc/chapters/use.xml +++ b/xmldoc/chapters/use.xml @@ -262,8 +262,9 @@ merged data to multiple destinations. As of this writing, Garmin's PVT protocol and NMEA are supported - inputs and KML is supported on output. Additional formats - may be added by interested parties later. + inputs. KML, NMEA, and the variou XCSV formats are supported on + output. Additional formats may be added by interested parties + later. gpsbabel -T -i garmin -f usb: -o kml -F xxx.kml -- 2.30.2